<%@ page import="custom.*,java.util.*" %>

<html>
<head>
<title>Address page</title>
</head>
<body>
	<%
		String firstName = (String)session.getAttribute("firstName");
		String middleName = (String)session.getAttribute("middleName");
		String lastName = (String)session.getAttribute("lastName");
		int ccid = (Integer)session.getAttribute("ccid");

        int crid = Integer.parseInt(request.getParameter("crid")); // country of residence id
		session.setAttribute("crid", crid);

		Vector countries = support.getCountries();
	%>
    First Name: <%= firstName %>
    <br>
    Middle Initial: <%= middleName %>
    <br>
    Last Name: <%= lastName %>
    <br>
    Country of citizenship: <%= countries.get(ccid) %>
    <br>
    Country of residence: <%= countries.get(crid) %>
    <br>

    <form action="degreeLocation.jsp" method="GET">
      <table>
      <tr>
        <td>Street:</td>
        <td><input size=50 name="street" value="" /> </td>
      </tr>
      <tr>
        <td>City:</td>
        <td><input size=50 name="city" value="" /></td>
      </tr>
      <tr>
        <!-- if the country of residence is not US then there will be no state text
             box but there will be a country telephone code -->
        <% if(crid==support.us_id) { %>
        <td>State:</td>
        <td><input size=20 name="state" value="" /></td>
        <% } else { %>
        <td>Country telephone code:</td>
        <td><input size=4 name="ctc" value="" /></td>
        <% } %>
      </tr>
      <tr>
        <td>Zip code:</td>
        <td><input size=4 name="zip" value="" /></td>
      </tr>
      <tr>
        <td>Area code:</td>
        <!-- limit the area code to maximum 4 digits -->
        <td><input maxLength="4" size=3 name="area" value="" /></td>
      </tr>
      <tr>
        <td>Phone:</td>
        <td><input size=10 name="phone" value="" /></td>
      </tr>
      <table>
      <input type="submit" value="Submit">
    </form>

</body>
</html>
